#include "GameObject.h"
#include "../Managers/GameManager.h"
#include "../Renderer/DeferredRenderer.h"

GameObject::GameObject(const Vec2i &pos, int tile, const TCODColor &color)
	: pos(pos), prev_pos(pos), tile(tile), color(color), sight_radius(40)
{
}

GameObject::~GameObject()
{
}

void GameObject::render()
{
	auto g_buffer = GameManager::getSingleton()->getRenderer();
	g_buffer->addSymbol(pos, tile, 1.0f); //No symbol more important than the player
	Vec3f frgr_color(color.r / 255.0f, color.g / 255.0f, color.b / 255.0f);
	g_buffer->shade(pos, frgr_color, DeferredRenderer::RL_FOREGROUND, DeferredRenderer::RT_DIFFUSE);
	g_buffer->shade(pos, Vec3f(0.5f, 0.5f, 0.5f), DeferredRenderer::RL_FOREGROUND, DeferredRenderer::RT_SPECULAR);
}

void GameObject::translate(int dx, int dy)
{
	prev_pos = pos; 
	pos.x() += dx; 
	pos.y() += dy;
}
